package com.tllq.zhongkang.controller;

import com.tllq.zhongkang.entity.MemCard;
import com.tllq.zhongkang.entity.ResultMap;
import com.tllq.zhongkang.service.MemCardService;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Slf4j
public class MemCardController {
    private Logger logger = LoggerFactory.getLogger(this.getClass());
    @Autowired
    MemCardService memCardService;

    @GetMapping("/scroll-member")
    public ResultMap findByNextId (Integer nextId){
        ResultMap res =null;
        if (StringUtils.isEmpty(nextId)){
            res = ResultMap.error("参数不能为空");
            logger.error("/scroll-member"+res);
            return res;
        }
        List<MemCard> memCards = memCardService.findByNextId(nextId);
        return ResultMap.ok(memCards);
    }

}
